package top.ligongzi.hrm.exception;

public class GlobalException extends  RuntimeException {

    private int code;
    //默认构造函数
    public GlobalException(){
        super();
    }


    //有错误提示信息
    public GlobalException(String message){
        super(message);
    }


    //有错误提示信息和错误
    public GlobalException(String message,Throwable cause){
        super(message,cause);
    }


    //传递code和Message
    //有错误提示信息
    public GlobalException(int code,String message){
        super(message);
        this.code = code;
    }

    //直接传递枚举类
    public GlobalException(ErrorCode code){
        super(code.getMessage());
        this.code = code.getCode();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
